// webpack.config.js
var webpack = require('webpack');
var ComponentPlugin = require("component-webpack-plugin");
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var ExtractSASS = new ExtractTextPlugin("build/style.css");
var ExtractLESS = new ExtractTextPlugin("build/style.css");
module.exports = {
    entry: "./src/main.js",
    output: {
        filename:"./build/build.js"
    },
    //watch: true,
    module: {
        loaders: [
            { test: /\.css$/, loader:ExtractTextPlugin.extract("style-loader","css-loader") },
            { test: /\.sass$/, loader: ExtractSASS.extract(["css", "postcss", "sass"]) },
            { test: /\.less$/, loader: ExtractLESS.extract(["css", "postcss", "less"]) }
        ]
    },
    postcss: [
        require('autoprefixer')//调用autoprefixer插件
    ],
    resolve: {
        root: 'F:/webpack/myapp/src', //绝对路径
        extensions: ['', '.js', '.jsx']
    },
    /******设置插件******/
    plugins: [
        //压缩js
        //new webpack.optimize.UglifyJsPlugin({
        //    compressor: {
        //        warnings: false
        //    }
        //}),
        new webpack.optimize.OccurenceOrderPlugin(),
        new ComponentPlugin(),
        ExtractSASS,
        ExtractLESS
        //new ExtractTextPlugin("build/style.css")
    ]
};
